OmniWeb Help

OmniWeb Help : Using AppleScript with OmniWeb

Using AppleScript with OmniWeb

Many things in OmniWeb can be controlled using the AppleScript scripting language.

For a complete look at all of the scriptable objects in OmniWeb you can view its scripting dictionary by dragging the OmniWeb application on to the icon for Apple's Script Editor application. Script Editor is installed by default in /Applications/AppleScript/.

AppleScript Examples

This script takes all of the tabs in a browser window and moves them into their own window.

tell application "OmniWeb"
     set theBrowser to front browser
     if (count tabs of theBrowser) > 1 then
          repeat until (count tabs of theBrowser) = 1
               set theTab to second tab of theBrowser
               set theAddress to address of theTab
               make new browser at end of browsers with properties {address:theAddress}
               delete theTab
          end repeat
     end if
     set has tabs of theBrowser to false
end tell

This one creates a single window with tabs from all the tabs in each window you have open.

tell application "OmniWeb"
     set mainBrowser to front browser
     set frontID to id of front browser
     set background to (every browser whose id is not frontID)
     repeat with theBrowser in background
          set theAddress to address of theBrowser
          tell mainBrowser to make new tab at end of tabs with properties {address:theAddress}
          close theBrowser
     end repeat
end tell

More AppleScripts for OmniWeb can be found in the Extras section of the OmniWeb product pages on omnigroup.com.

Copyright © 2004-2005 The Omni Group